<template>
  <el-select placeholder="请选择频道" clearable :value="value" @change="change">
    <el-option
    :label="item.name"
    :value="item.id"
    v-for="item in channels"
    :key="item.id">
    </el-option>
 </el-select>
</template>

<script>
import { reqGetChannel } from '@/api/articles'
export default {
  name: 'HmChannels',
  props: ['value'],
  data () {
    return {
      channels: []
    }
  },
  created () {
    this.getChannels()
  },
  methods: {
    async getChannels () {
      const res = await reqGetChannel()
      this.channels = res.data.data.channels
    },
    change (val) {
      this.$emit('input', val)
    }
  }

}
</script>

<style>

</style>
